/*
 * @(#) AuthInterceptor.java 2010-9-17
 *
 * Copyright (c) 2010, Strong Technology. All Rights Reserved.
 * Strong Technology. CONFIDENTIAL
 */
package cn.strong.gweva.common.interceptor;

import java.util.Map;

import cn.strong.gweva.common.util.Constants;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

/**
 * 验证是否登录的interceptor
 * @author lilanfei
 * @version 1.0
 * @since 2010-9-6
 */
public class AuthInterceptor extends AbstractInterceptor
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	@SuppressWarnings("unchecked")
	public String intercept(ActionInvocation invocation) throws Exception
	{
		Map map = invocation.getInvocationContext().getSession();
		
		//判断session中是否有登陆信息
		if(map.get(Constants.SESSION_LOGIN_USER_INF) == null)
		{
			return Action.LOGIN;
		}
		else
		{
			//继续下一个interceptor
			return invocation.invoke();
		}
	}

}
